package com.geekhalo.admin.app.user;

import com.geekhalo.admin.domain.user.changePassword.ChangePasswordCommand;
import com.geekhalo.admin.domain.user.changePassword.ChangePasswordContext;
import com.geekhalo.admin.domain.user.create.CreateUserCommand;
import com.geekhalo.admin.domain.user.create.CreateUserContext;
import com.geekhalo.admin.domain.user.disable.DisableUserCommand;
import com.geekhalo.admin.domain.user.disable.DisableUserContext;
import com.geekhalo.admin.domain.user.enable.EnableUserCommand;
import com.geekhalo.admin.domain.user.enable.EnableUserContext;
import com.geekhalo.admin.domain.user.update.UpdateUserCommand;
import com.geekhalo.admin.domain.user.update.UpdateUserContext;
import com.geekhalo.lego.core.command.CommandApplicationServiceDefinition;
import com.geekhalo.lego.core.command.CommandMethodDefinition;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import com.geekhalo.admin.domain.user.UserCommandRepository;
import com.geekhalo.admin.domain.user.User;

@CommandApplicationServiceDefinition(
        domainClass = User.class,
        repositoryClass = UserCommandRepository.class
)
@Validated
public interface UserCommandApplication {

    @CommandMethodDefinition(contextClass = CreateUserContext.class)
    User create(@Valid CreateUserCommand command);

    @CommandMethodDefinition(contextClass = EnableUserContext.class)
    void enable(@Valid EnableUserCommand command);

    @CommandMethodDefinition(contextClass = DisableUserContext.class)
    void disable(@Valid DisableUserCommand command);

    @CommandMethodDefinition(contextClass = UpdateUserContext.class)
    void update(@Valid UpdateUserCommand command);

    @CommandMethodDefinition(contextClass = ChangePasswordContext.class)
    void changePassword(@Valid ChangePasswordCommand command);
}
